package co.yixiang.upms.biz;

import co.yixiang.common.core.utils.SpringContextHolder;
import co.yixiang.common.security.annotation.EnableCustomConfig;
import co.yixiang.common.security.annotation.EnableYxFeignClients;
import co.yixiang.common.security.annotation.EnableYxResourceServer;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.context.request.RequestContextListener;

/**
 * 后台管理模块
 *
 * @author yshop
 */
@EnableCustomConfig
@EnableYxFeignClients
@SpringCloudApplication
@EnableYxResourceServer
public class YshopUpmsApplication
{
    public static void main(String[] args)
    {
        SpringApplication.run(YshopUpmsApplication.class, args);
        System.out.println(
                        "              __                  \n" +
                        "  __ __ ___  / /  ___   ___       \n" +
                        " / // /(_-< / _ \\/ _ \\ / _ \\   \n" +
                        " \\_, //___//_//_/\\___// .__/    \n" +
                        "/___/                /_/          \n "+

                        "\n意象yshop电商系统权限管理系统服务启动成功 \n官网：https://www.yixiang.co 提供技术支持ﾞ  \n");
    }

    @Bean
    public SpringContextHolder springContextHolder() {
        return new SpringContextHolder();
    }


    /**
     * 监听器：监听HTTP请求事件
     * 解决RequestContextHolder.getRequestAttributes()空指针问题
     * @return
     */
    @Bean
    public RequestContextListener requestContextListener(){
        return new RequestContextListener();
    }
}
